#include "stdio.h"
 
int a[12] = {1,3,5,7,9,11,2,7,6,8,1,12};
void quick_sort(int a[],int low, int high);
int partition(int a[],int low,int high);
void swap(int a[], int x, int y);
int main()
{
    quick_sort(a, 0, 12-1);
    for(int i=0;i<12;i++)
    printf("%d  ",a[i]);
 }

 void quick_sort(int a[], int low, int high)
 {
     int pivot;
     if(low<high)
     {
     pivot = partition(a,low,high);
      quick_sort(a,low,pivot-1);
      quick_sort(a,pivot+1,high);
     }
    //   else return;
 }

 int partition(int a[], int low, int high)
 {
     int  pivot;
     pivot = a[low];
     while(low<high)
     {
         while(pivot<=a[high]&&low<high)high--;
         swap(a,high,low);
         while(pivot>=a[low]&&low<high)low++;
         swap(a,high,low);
     }
     return low;
 }

void swap(int a[],int low, int high)
{
    int temp;
    temp = a[low];
    a[low] = a[high];
    a[high] = temp;
}